class Sdr {
    constructor(name) {
        this.name = name;
        this.timer = {};
        this.rf_init_value = new RFValue(
            874.2,
            40,
            {from:30,to:1700},
            0
        );
        this.afc = function() {
            console.log("undefined afc method");
        }
        this.start = function() {
            console.log("undefined start method");
        }
        this.cancel = function() {
            console.log("undefined cancel method");
        }
        this.on = {};
        this.onEvent = function(event,args) {
            var f = this.on[event] || function(o,a) {console.log("undefined",event);}
            f(this,args);
        };
        this.clearAllTimer = function() {
            Object.values(this.timer).forEach(function(t) {clearInterval(t)});
        };
    };
};

Sdr.clearAll = function() {
    $("#rx_config").empty();
    $("multiframe").empty();
    Sdr.clearAllTimer();
    _G.ioc.clear();
};

Sdr.clearAllTimer = function() {
    Object.values(_G.sdrs).forEach(function(sdr) {sdr.clearAllTimer();});
};

Sdr.current = function() {
    return _G.sdrs[_G.sdr];
};